package com.example.demojimmer.application.dto;

import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
public class Results<T> {

    /**
     * 业务操作代码 (正常,异常)
     */
    private int code;

    /**
     * 业务消息
     */
    private String msg;

    /**
     * 业务数据
     */
    private T data;


    public static <T> Results<T> res(int code, String msg, T data) {
        Results<T> results = new Results<T>();
        results.setCode(code);
        results.setMsg(msg);
        results.setData(data);
        return results;
    }

    //处理成功
    public static <T> Results<T> ok(T data) {
        Results<T> results = new Results<T>();
        results.setCode(0);
        results.setMsg("ok");
        results.setData(data);
        return results;
    }

}
